package com.example.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.blog.domain.Writings;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;

@Mapper
public interface WritingsMapper extends BaseMapper<Writings> {
    //查询所有文章的图片
    @Select("select image as img from writings where uid = #{id}")
    String[]  selectUserImage(@Param("index") long id);

    //统计文章总数量
    @Select("select count(uid) from writings")
    long writingsLength();
}
